/**
 * 
 */
package com.base.myproject.client.ui;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.PopupPanel;

/**
 * 瞬间弹出的图片对话框
 * 
 * @author zgw 2009-8-7 下午10:38:31 javazgw@gmail.com
 */
public class BasePopupImage {
	static BasePopupImage bpi;

	private BasePopupImage() {
		init();

	}

	void init() {

	}

	public static BasePopupImage getInstance() {
		if (bpi == null) {
			bpi = new BasePopupImage();
		}
		return bpi;
	}

	public void show(String imageurl) {
		
		Image image  = new Image(imageurl);
		final PopupPanel imagePopup = new PopupPanel(true);
		imagePopup.setAnimationEnabled(true);
		imagePopup.ensureDebugId("cwBasicPopup-imagePopup");
		imagePopup.setWidget(image);
		image.addClickHandler(new ClickHandler() {
		      public void onClick(ClickEvent event) {
		    	  imagePopup.hide();
		      }
		    });
		imagePopup.center();
	}
}
